//JavaScript Document

//可以转换图片的Button的
function ChangeButton(pV, bR)
{
    var _this = this;
    Button.call(_this, pV, bR);
    
    _this.img = new Image();
    _this.src_1 = undefined;
    _this.src_2 = undefined;
    _this.ready = false;
    
    _this.imgLoadCallBack = function()
    {
        _this.ready = true;
    }
    
    _this.draw = function(canvas)
    {
        var cxt = canvas.getContext("2d");
        cxt.drawImage(_this.img, _this.position.x, _this.position.y);
    }
    
    
    _this.changeIn = function()
    {
         _this.img.src = _this.src_2; 
         _this.img.onload = _this.imgLoadCallBack;    
    }
    
    _this.changeOut = function()
    {
        _this.img.src = _this.src_1;
        _this.img.onload = _this.imgLoadCallBack;   
    }
    
        var init = function()
    {
        _this.img.src = "./images/Start.png";
        _this.img.onload = _this.imgLoadCallBack;
    }
    
    init();
}
inheritPrototype(ChangeButton ,Button);
